export default {
  router: {
    // 项目在服务器上的前缀
    base: '/h5-web/hhx/',
    // 扩展Nuxt.js创建的路由
    extendRoutes(routes, resolve) {
      routes.push({
        path: '*',
        component: '@/pages/404.vue'
      })
      //本来想foreach的 但是set方法在这不管用
      for (let i in routes) {
        routes[i]['meta'] = {
          title: routes[i].name,
        }
        if (routes[i].children) {
          for (let j in routes[i].children) {
            routes[i].children[j]['meta'] = {
              title: routes[i].children[j].name.substring(5),
              icon: 'el-icon-umbrella'
            }
          }
        }
      }
    }
  },
  // Global page headers (https://go.nuxtjs.dev/config-head)
  head: {
    title: 'original-favor',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    //ico图标也要加上这个前缀
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/h5-web/hhx/favicon.ico' }
    ]
  },

  // Global CSS (https://go.nuxtjs.dev/config-css)
  css: [
    'element-ui/lib/theme-chalk/index.css',
    // 项目里要用的 CSS 文件
    '@/assets/css/main',
    '@/assets/icon/iconfont.css'
  ],

  // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  plugins: [
    '@/plugins/element-ui',
    '@/plugins/permission'
  ],

  // Auto import components (https://go.nuxtjs.dev/config-components)
  components: true,

  // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  buildModules: [
  ],

  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
  ],

  // Axios module configuration (https://go.nuxtjs.dev/config-axios)
  axios: {},

  // Build Configuration (https://go.nuxtjs.dev/config-build)
  build: {
    transpile: [/^element-ui/],
  }
}
